$state['userid'] = $user->getId();
// Update user count
- \DeferredUpdates::addUpdate( new \SiteStatsUpdate( 0, 0, 0, 0, 1 ) );
+ \DeferredUpdates::addUpdate( \SiteStatsUpdate::factory( [ 'users' => 1 ] ) );
// Watch user's userpage and talk page
$user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
$user->saveSettings();
// Update user count
- \DeferredUpdates::addUpdate( new \SiteStatsUpdate( 0, 0, 0, 0, 1 ) );
+ \DeferredUpdates::addUpdate( \SiteStatsUpdate::factory( [ 'users' => 1 ] ) );
// Watch user's userpage and talk page
\DeferredUpdates::addCallableUpdate( function () use ( $user ) {
$user->addWatch( $user->getUserPage(), User::IGNORE_USER_RIGHTS );
* @param int $u1 Unused
* @param bool $u2 Unused
* @param array|string &$error Array of errors to append to
- * @param User $user The deleting user
+ * @param User $deleter The deleting user
* @param array $tags Tags to apply to the deletion action
* @param string $logsubtype
* @return Status Status object; if successful, $status->value is the log_id of the
* found, $status is a non-fatal 'cannotdelete' error
*/
public function doDeleteArticleReal(
- $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null,
+ $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $deleter = null,
$tags = [], $logsubtype = 'delete'
) {
global $wgUser, $wgContentHandlerUseDB, $wgCommentTableSchemaMigrationStage,
// Avoid PHP 7.1 warning of passing $this by reference
$wikiPage = $this;
- $user = is_null( $user ) ? $wgUser : $user;
+ $deleter = is_null( $deleter ) ? $wgUser : $deleter;
if ( !Hooks::run( 'ArticleDelete',
- [ &$wikiPage, &$user, &$reason, &$error, &$status, $suppress ]
+ [ &$wikiPage, &$deleter, &$reason, &$error, &$status, $suppress ]
) ) {
if ( $status->isOK() ) {
// Hook aborted but didn't set a fatal status
$logtype = $suppress ? 'suppress' : 'delete';
$logEntry = new ManualLogEntry( $logtype, $logsubtype );
- $logEntry->setPerformer( $user );
+ $logEntry->setPerformer( $deleter );
$logEntry->setTarget( $logTitle );
$logEntry->setComment( $reason );
$logEntry->setTags( $tags );
$dbw->endAtomic( __METHOD__ );
- $this->doDeleteUpdates( $id, $content, $revision, $user );
+ $this->doDeleteUpdates( $id, $content, $revision, $deleter );
Hooks::run( 'ArticleDeleteComplete', [
&$wikiPageBeforeDelete,
- &$user,
+ &$deleter,
$reason,
$id,
$content,
protected $data;
protected $regex;
- protected $tempType, $tempMergePrefix;
protected $circularRefGuard;
protected $recursionLevel = 0;
return $text;
}
- $oldType = $this->tempType;
- $this->tempType = $type;
- $text = preg_replace_callback( $this->regex, [ $this, 'unstripCallback' ], $text );
- $this->tempType = $oldType;
- return $text;
- }
-
- /**
- * @param array $m
- * @return array
- */
- protected function unstripCallback( $m ) {
- $marker = $m[1];
- if ( isset( $this->data[$this->tempType][$marker] ) ) {
- if ( isset( $this->circularRefGuard[$marker] ) ) {
- return '<span class="error">'
- . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
- . '</span>';
- }
- if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
- return '<span class="error">' .
- wfMessage( 'parser-unstrip-recursion-limit' )
- ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
- '</span>';
+ $callback = function ( $m ) use ( $type ) {
+ $marker = $m[1];
+ if ( isset( $this->data[$type][$marker] ) ) {
+ if ( isset( $this->circularRefGuard[$marker] ) ) {
+ return '<span class="error">'
+ . wfMessage( 'parser-unstrip-loop-warning' )->inContentLanguage()->text()
+ . '</span>';
+ }
+ if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
+ return '<span class="error">' .
+ wfMessage( 'parser-unstrip-recursion-limit' )
+ ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
+ '</span>';
+ }
+ $this->circularRefGuard[$marker] = true;
+ $this->recursionLevel++;
+ $value = $this->data[$type][$marker];
+ if ( $value instanceof Closure ) {
+ $value = $value();
+ }
+ $ret = $this->unstripType( $type, $value );
+ $this->recursionLevel--;
+ unset( $this->circularRefGuard[$marker] );
+ return $ret;
+ } else {
+ return $m[0];
}
- $this->circularRefGuard[$marker] = true;
- $this->recursionLevel++;
- $value = $this->data[$this->tempType][$marker];
- if ( $value instanceof Closure ) {
- $value = $value();
- }
- $ret = $this->unstripType( $this->tempType, $value );
- $this->recursionLevel--;
- unset( $this->circularRefGuard[$marker] );
- return $ret;
- } else {
- return $m[0];
- }
+ };
+
+ $text = preg_replace_callback( $this->regex, $callback, $text );
+ return $text;
}
/**
}
}
- $this->tempMergePrefix = $mergePrefix;
- $texts = preg_replace_callback( $otherState->regex, [ $this, 'mergeCallback' ], $texts );
- $this->tempMergePrefix = null;
+ $callback = function ( $m ) use ( $mergePrefix ) {
+ $key = $m[1];
+ return Parser::MARKER_PREFIX . $mergePrefix . '-' . $key . Parser::MARKER_SUFFIX;
+ };
+ $texts = preg_replace_callback( $otherState->regex, $callback, $texts );
return $texts;
}
- /**
- * @param array $m
- * @return string
- */
- protected function mergeCallback( $m ) {
- $key = $m[1];
- return Parser::MARKER_PREFIX . $this->tempMergePrefix . '-' . $key . Parser::MARKER_SUFFIX;
- }
-
/**
* Remove any strip markers found in the given text.
*
NS_MEDIA => 'ذريعات',
NS_SPECIAL => 'خاص',
NS_TALK => 'بحث',
- NS_USER => 'Ù\8aÙ\88زر',
- NS_USER_TALK => 'Ù\8aÙ\88زر_بحث',
+ NS_USER => 'Ù\88اپرائÙ\8aÙ\86دÚ\99',
+ NS_USER_TALK => 'Ù\88اپرائÙ\8aÙ\86دÚ\99_بحث',
NS_PROJECT_TALK => '$1_بحث',
- NS_FILE => 'عڪس',
- NS_FILE_TALK => 'عڪس_بحث',
+ NS_FILE => 'فائل',
+ NS_FILE_TALK => 'فائل_بحث',
NS_MEDIAWIKI => 'ذريعات_وڪي',
NS_MEDIAWIKI_TALK => 'ذريعات_وڪي_بحث',
NS_TEMPLATE => 'سانچو',
- NS_TEMPLATE_TALK => 'سنچو_بحث',
+ NS_TEMPLATE_TALK => 'سانچو_بحث',
NS_HELP => 'مدد',
NS_HELP_TALK => 'مدد_بحث',
NS_CATEGORY => 'زمرو',
NS_CATEGORY_TALK => 'زمرو_بحث',
];
+$namespaceAliases = [
+ 'يوزر' => NS_USER,
+ 'يوزر_بحث' => NS_USER_TALK,
+ 'عڪس' => NS_FILE,
+ 'عڪس_بحث' => NS_FILE_TALK,
+ 'سنچو' => NS_TEMPLATE,
+ 'سنچو_بحث' => NS_TEMPLATE_TALK,
+];
+
$specialPageAliases = [
'Allmessages' => [ 'سڀ نياپا' ],
'Allpages' => [ 'سڀ صفحا' ],